package leetcode.code1018;

import java.util.ArrayList;
import java.util.List;

import leetcode.IDebug;

//1. (a + b) % p = (a % p + b % p) % p
//2. (a - b) % p = (a % p - b % p) % p
//3. (a * b) % p = (a % p * b % p) % p
//4. (a^b) % p = ((a % p)^b) % p
public class Solution implements IDebug {

	public List<Boolean> prefixesDivBy5(int[] nums) {
		int len = nums.length;
		List<Boolean> ans = new ArrayList<>();
		int num = 0;
		for (int i = 0; i < len; i++) {
			num <<= 1;
			num |= nums[i];
			num %= 5;
			ans.add(num == 0);
		}
		return ans;
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		for (int i = 0; i < 101; i++) {
			if (i % 5 == 0) {
				System.out.println(Integer.toBinaryString(i) + " " + i);
			}
		}

	}

}
